package org.ushio.nchu_22201406.dao;

import org.apache.ibatis.annotations.*;
import org.ushio.common_module.entity.MyPackage;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface packageDao {

    @Select("SELECT Package_ID, Package_Description, Package_Name, Package_Price, Package_Data, Package_Call_Time FROM package")
    @Results({
            @Result(property = "packageId", column = "Package_ID"),
            @Result(property = "packageDescription", column = "Package_Description"),
            @Result(property = "packageName", column = "Package_Name"),
            @Result(property = "packagePrice", column = "Package_Price"),
            @Result(property = "packageData", column = "Package_Data"),
            @Result(property = "packageCallTime", column = "Package_Call_Time"),

    })
    List<MyPackage> getAllPackages();
    @Update("UPDATE package SET Package_Description = #{packageDescription}, Package_Name = #{packageName}, Package_Price = #{packagePrice}, Package_Data = #{packageData}, Package_Call_Time = #{packageCallTime} WHERE Package_ID = #{packageId}")
    void updatePackage(MyPackage myPackage);


    @Update("UPDATE business_information SET Package_ID = #{Package_ID} WHERE Phone_Number = #{phoneNumber}")
    void updatePackageIdByPhoneNumber(@Param("phoneNumber") String phoneNumber, @Param("Package_ID") int Package_ID);

}
